package com.systop.scos.msg.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import com.systop.common.modules.security.user.model.User;
import com.systop.core.model.BaseModel;

@Entity
@Table(name = "message")
@SuppressWarnings("serial")
public class Message extends BaseModel {

	/** 主键 */
	private Integer id;

	/** 发送者 */
	private User sender;

	/** 主题、标题 */
	//private String title;

	/** 内容 */
	private String content;

	/** 信息类型 */
	private String msgType;

	/** 创建时间 */
	private Date createTime;

	/** 接收者 */
	private User receiver;

	/** 是否已读 */
	private String isRead;

	/** 发送者删除状态 */
	private String senderDel;

	/** 接收者删除状态 */
	private String receiverDel;

	/** 附件序列,存储多个附件ID","分割 */
	private String fileIds;

	@Id
	@GeneratedValue(generator = "hibseq")
	@GenericGenerator(name = "hibseq", strategy = "hilo")
	@Column(name = "ID", nullable = false)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name="sender_id")
	public User getSender() {
		return sender;
	}

	public void setSender(User sender) {
		this.sender = sender;
	}

//	public String getTitle() {
//		return title;
//	}
//
//	public void setTitle(String title) {
//		this.title = title;
//	}

	@Type(type = "text")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getMsgType() {
		return msgType;
	}

	public void setMsgType(String msgType) {
		this.msgType = msgType;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name="receiver_id")
	public User getReceiver() {
		return receiver;
	}

	public void setReceiver(User receiver) {
		this.receiver = receiver;
	}

	public String getIsRead() {
		return isRead;
	}

	public void setIsRead(String isRead) {
		this.isRead = isRead;
	}

	public String getSenderDel() {
		return senderDel;
	}

	public void setSenderDel(String senderDel) {
		this.senderDel = senderDel;
	}

	public String getReceiverDel() {
		return receiverDel;
	}

	public void setReceiverDel(String receiverDel) {
		this.receiverDel = receiverDel;
	}

	public String getFileIds() {
		return fileIds;
	}

	public void setFileIds(String fileIds) {
		this.fileIds = fileIds;
	}

}
